<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <title>商品管理</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <script src="https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
    <!--    <script rel="script" type="text/javascript" th:src="@{/js/jquery-3.5.1.min.js}"></script>-->
    <link rel="stylesheet" th:href="@{/layui/css/layui.css}"  media="all">
    <link rel="stylesheet" th:href="@{/css/itemManager.css}"  media="all">
    <script rel="script" type="text/javascript" th:src="@{/layui/layui.js}"></script>
    <script rel="script" type="text/javascript" th:src="@{/js/itemManager.js}"></script>
    <script type="text/javascript" th:src="@{/js/formVerify.js}"></script>

</head>
<body>


<!--<button id="disableRole" type="button" class="layui-btn" style="margin-left: 40% ; display: none" onclick="" >禁用角色</button>-->
<!--<button id="enableRole" type="button" class="layui-btn" style="margin-left: 40% ; display: none" onclick="" >启用角色</button>-->
<table class="layui-hide" id="itemList" lay-filter="itemList"></table>

<script type="text/html" id="topTools">
    <form class="layui-form layui-form-pane" lay-filter="itemSearchForm">
    <div class="layui-inline">
        <input id="searchItemName" lay-filter="searchItemName" type="text" class="layui-input-block" autocomplete="off" placeholder="请输入查询关键字(商品名)"/>
        <div id="selectParentCategory" class="layui-input-block layui-inline ">
            <select id="parentCategorySelect" name="parentCategorySelect" lay-filter="parentCategory"  lay-event="parentCategory" class="select">
            </select>
        </div>
        <div id="selectChildCategory" class="layui-input-block layui-inline layui-hide">
            <select id="childCategorySelect" name="childCategorySelect" lay-filter="childCategory" lay-event="childCategory" class="select ">
            </select>
        </div>
    </div>
    <div class="layui-btn-container layui-inline" id="toolsBtnGroup">
        <button type="button" class="layui-btn layui-btn-normal" lay-event="searchItem">搜索商品</button>
        <button type="button" class="layui-btn layui-btn-normal" lay-event="addItem">新增商品</button>
        <button type="button" class="layui-btn layui-btn-danger" lay-event="reloadTable">刷新表格</button>
    </div>
    </form>
</script>

<script type="text/html" id="itemOperator">
    <a class="layui-btn  layui-btn-xs" lay-event="edit">编辑</a>
    {{# if(d.stock == 0){  }}
    <a class="layui-btn  layui-btn-xs" lay-event="restocking">补充库存</a>
    {{# } }}
    {{# if(d.onOffStatus == 2 ){ }}
    <a class="layui-btn layui-btn-xs"  lay-event="enable">上架</a>
    {{# }else if(d.onOffStatus == 1 ){ }}
    <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="disable">下架</a>
    {{# } }}
</script>





<div id="createItem" class="layui-form" style="display: none">
<!--    -->
    <form class="layui-form layui-form-pane" name="item-form" autocomplete="off" >
        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px; margin-left: 0px">
            <legend>商品设置</legend>
        </fieldset>
        <div class="layui-form-item layui-input-inline" name="form-item">
            <div class="layui-inline" name="form-item-inline">
                    <label class="layui-form-label">商品名</label>
                    <input type="text" name="itemName" class="layui-input" lay-verify="required"><br>
            </div>
            <div class="layui-inline" name="form-item-inline">
                <label class="layui-form-label">库存</label>
                <input type="text" name="stock" class="layui-input" lay-verify="required|stock" ><br>
            </div><br>
            <div class="layui-inline" name="form-item-inline">
                <label class="layui-form-label">父分类</label>
                <div class="layui-input-block" style="width: 50%">
                    <select id="parentItemSelect" name="parentItemSelect" lay-filter="parentItem"  class="select">
                    </select>
                </div>
            </div>
            <div class="layui-inline" name="form-item-inline">
                <label class="layui-form-label">子分类</label>
                    <div class="layui-input-block" style="width: 50%">
                        <select id="childItemSelect" name="childItemSelect" lay-filter="childItem"  class="select">
                        </select>
                    </div>
            </div><br>

            <div class="layui-inline" name="form-item-inline">
                <label class="layui-form-label">原价</label>
                <input type="text" name="priceNormal" class="layui-input" lay-verify="required|discount" ><br>
            </div>
            <div class="layui-inline" name="form-item-inline">
                <label class="layui-form-label">折扣力度</label>
                <input type="text" name="discount" class="layui-input" lay-verify="required|price"  ><br>
            </div><br>
            <div class="layui-inline" name="for-item-inline">
                <label class="layui-form-label">商品内容</label>
                <input type="text" name="itemDesc" class="layui-input" lay-verify="required" ><br>
            </div><br>
            <label class="layui-form-label">是否为特选</label>
            <div class="layui-inline" name="form-item-inline">
                <div class="layui-input-inline">
                    <input type="radio"  name="isSpecial" value="1" title="是">
                    <input type="radio"  name="isSpecial" value="0" checked="checked" title="否">
                </div>
            </div><br>
            <fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;margin-left: 0px">
                <legend>商品参数</legend>
            </fieldset>
            <div class="layui-inline" name="form-item-inline">
                <label class="layui-form-label">品牌名</label>
                <input type="text" name="brand" class="layui-input" lay-verify="required" ><br>
            </div>
            <div class="layui-inline" name="form-item-inline">
                <label class="layui-form-label">保质期</label>
                <input type="text" name="footPeriod" class="layui-input" lay-verify="required" ><br>
            </div><br>

            <div class="layui-inline" name="form-item-inline">
                <label class="layui-form-label">生产厂家</label>
                <input type="text" name="factoryName" class="layui-input" lay-verify="required" ><br>
            </div>

            <div class="layui-inline" name="form-item-inline">
                <label class="layui-form-label">厂家地址</label>
                <input type="text" name="factoryAddress" class="layui-input" lay-verify="required" ><br>
            </div><br>
            <div class="layui-inline" name="form-item-inline">
                <label class="layui-form-label">产地</label>
                <input type="text" name="productPlace" class="layui-input" lay-verify="required" ><br>
            </div>

            <div class="layui-inline" name="form-item-inline">
                <label class="layui-form-label">包装方式</label>
                <input type="text" name="packagingMethod" class="layui-input" lay-verify="required" ><br>
            </div><br>

            <div class="layui-inline" name="form-item-inline">
                <label class="layui-form-label">产品规格</label>
                <input type="text" name="weight" class="layui-input" lay-verify="required" ><br>
            </div>

            <div class="layui-inline" name="form-item-inline">
                <label class="layui-form-label">储存方法</label>
                <input type="text" name="storageMethod" class="layui-input" lay-verify="required" ><br>
            </div><br>

            <div class="layui-inline" name="form-item-inline">
                <label class="layui-form-label">食用方法</label>
                <input type="text" name="eatMethod" class="layui-input" lay-verify="required" ><br>
            </div><br>
            <div id="imageUploadDiv">
                <fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;margin-left: 0px">
                    <legend>商品图片</legend>
                </fieldset>
                <button type="button" class="layui-btn layui-btn-normal" id="itemMainImage"><i class="layui-icon"></i>商品头图</button><br><br>
                <blockquote class="layui-elem-quote layui-quote-nm" style="margin-top: 10px; width: 80px" >
                    <div class="layui-upload-list" id="demo1"></div>
                </blockquote>
                <button type="button" class="layui-btn layui-btn-normal" id="itemImages"><i class="layui-icon"></i>商品图片</button>
                <blockquote class="layui-elem-quote layui-quote-nm" style="margin-top: 10px; width: 200px">
                    <div class="layui-upload-list" id="demo2"></div>
                </blockquote>
            </div><br>

            <label class="layui-form-label">商品描述</label>
            <!--  <input type="text" name="itemDesc" class="layui-input" lay-verify="required" ><br>-->
            <br>
            <br>
            <br>

            <textarea id="itemDescText" style="display: none;"></textarea>
            <br>
            <input type="hidden" id="imageList" value="">

            <input type="hidden" id="itemDesc" name="itemDesc" value="">

            <input type="hidden" id="mainImage" value="">

            <input type="hidden" id="iconImage" value="">

            <input type="hidden" id="parentCategoryList" value="">

            <input type="hidden" id="childCategoryList" value="">

            <input type="hidden" id="itemId" value="">



<!--           -->
<!--            <div class="layui-inline">-->
<!--                <label class="layui-form-label">商品头图</label>-->
<!--                <input type="file" id="itemMainImage" name="itemMainImage" class="layui-input " accept="image/*" style="width: 50%"><br>-->
<!--            </div>-->
<!--            <div class="layui-inline">-->
<!--                <label class="layui-form-label">商品图片</label>-->
<!--                <input type="file" id="itemImages" name="itemImages" class="layui-input" accept="image/*" style="width: 50%" multiple><br>-->
<!--            </div>-->


            <hr class="hr15">
            <div class="layui-inline">
                <button type="button" action="javascript:void(0)" lay-submit="" id="btn_yes" class="layui-btn" style="margin-left: 40%">确定</button>
<!--                <button type="button" action="javascript:void(0)"  id="btn_test" class="layui-btn" style="margin-left: 40%">测试取值</button>-->
            </div>
        </div>
    </form>
</div>




<div id="restockModel" class="layui-form" style="display: none">
    <div class="layui-inline">
        <label class="layui-form-label">库存</label>
        <input type="text" id="restock" class="layui-input" lay-verify="required|stock" style="width: 50%"><br>
        <button id="btn_restock" lay-filter="restock" lay-submit="" type="button" action="javascript:void(0)" class="layui-btn"  onclick="restock()">修改商品</button>
    </div>
</div>


</body>
<script>

</script>
</html>